﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;
using System.ComponentModel.DataAnnotations;

namespace AuctionHouseDataLibrary
{
    [Serializable]
    [DataContract]
    public class Item
    {
        [DataMember]
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        public int ItemId { get; set; }
        [DataMember]
        [MaxLength(100)]
        public string ItemName { get; set; }

        [DataMember]
        public int DisplayId { get; set; }
        [DataMember]
        [MaxLength(50)]
        public string DisplayIcon { get; set; }

        [DataMember]
        public int InventorySlotId { get; set; }
        [DataMember]
        [MaxLength(50)]
        public string InventorySlotDesc { get; set; }

        [DataMember]
        public int ItemLevel { get; set; }
        [DataMember]
        public int RequiredLevel { get; set; }

        [DataMember]
        public int ClassId { get; set; }
        [DataMember]
        [MaxLength(50)]
        public string ClassDesc { get; set; }

        [DataMember]
        public int SubclassId { get; set; }
        [DataMember]
        [MaxLength(50)]
        public string SubclassDesc { get; set; }

        [DataMember]
        public int QualityId { get; set; }
        [DataMember]
        [MaxLength(50)]
        public string QualityDesc { get; set; }

        [DataMember]
        public int SellPrice { get; set; }

        [DataMember]
        public bool DataUpdated { get; set; }

        public override string ToString()
        {
            return string.Format("({0}} - {1}",ItemId, ItemName);
        }

        public static Item EmptyItem(int itemId)
        {
            return new Item() { ItemId = itemId, DisplayIcon = "unavailable", ItemName = "Unknown", DataUpdated = false};
        }
    }
}